import { setData, getData } from "@/utils/storage.js";

import { defineStore } from 'pinia';

let useComputerStore = defineStore('ComputerStore', {
  state: () => {
    return {
        computerList: getData('computerList') || [],
        commandList: getData('commandList') || [],
    };
  },
  actions: {
    updateComputerList(list) {
      if(setData('computerList', list)) this.computerList = list
    },
    updateCommandList(list) {
      if(setData('commandList', list)) this.commandList = list
    },
  },
});

export default useComputerStore;
